Page({

  /**
   * 页面的初始数据
   */
  data: {
    currentData: 0,
    xinwens: [{
      picurl: "../../imgs/img/th1.jpg",
      title: "人生若只如初见，何事秋风悲画扇。等闲变却故人心，却道故人心易变。",
      date: "1314-5-20 13:14",
      pinglunNum: 5
    }, {
      picurl: "../../imgs/img/th2.jpg",
      title: "人生若只如初见，何事秋风悲画扇。等闲变却故人心，却道故人心易变。",
      date: "1314-5-20 13:14",
      pinglunNum: 2
    }, {
      picurl: "../../imgs/img/th3.jpg",
      title: "人生若只如初见，何事秋风悲画扇。等闲变却故人心，却道故人心易变。",
      date: "1314-5-20 13:14",
      pinglunNum: 0
    }, {
      picurl: "../../imgs/img/th4.jpg",
      title: "人生若只如初见，何事秋风悲画扇。等闲变却故人心，却道故人心易变。",
      date: "1314-5-20 13:14",
      pinglunNum: 13
    }, {
      picurl: "../../imgs/img/th5.jpg",
      title: "人生若只如初见，何事秋风悲画扇。等闲变却故人心，却道故人心易变。",
      date: "1314-5-20 13:14",
      pinglunNum: 14
    }, ]
  },
  xxx: function (e) {
    var index = e.currentTarget.dataset.index
    var data = this.data.xinwens
    wx.navigateTo({
      url: '../../xinwens/ZYxinwen/ZYxinwen?data=' + encodeURIComponent(JSON.stringify(data[index])),
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {},
  //获取当前滑块的index
  bindchange: function (e) {
    const that = this;
    that.setData({
      currentData: e.detail.current
    })
  },
  //点击切换，滑块index赋值
  checkCurrent: function (e) {
    const that = this;

    if (that.data.currentData === e.target.dataset.current) {
      return false;
    } else {

      that.setData({
        currentData: e.target.dataset.current
      })
    }
  }
})